<template>
  <div class="product-list">
    <div class="lists" v-for="item in productList" :key="item.id" @click="itemClick(item)">
      <div class="title">{{ item.title }}</div>
      <div class="main">
        <div class="imgs">
          <img :src="item.icons" alt="" />
        </div>
        <div class="container">
          <div class="desc">{{ item.desc }}</div>
          <div class="bottom">
            <div class="left">
              <div class="icons">
                <img :src="item.icons2" alt="" />
              </div>
              <span>产品咨询</span>
            </div>
            <div class="right">
              <div class="icons">
                <img :src="item.icons3" alt="" />
              </div>
              <div class="number">{{ item.number }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {}
  },
  props: {
    productList: {
      type: Array,
      default() {
        return []
      },
    },
  },
  computed: {},
  created() {},
  mounted() {},
  methods: {
    itemClick(item) {
      let index = this.productList.findIndex(items => items.id == item.id );
      // console.log(index);
      this.$emit('productClick', index)
    }
  },
}
</script>

<style scoped lang="scss">
.lists {
  margin: 12px 0;
  padding: 0 12px;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  .title {
    margin: 16px 0 12px;
    font-size: 16px;
    font-weight: bolder;
    color: #1f0d44;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .main {
    margin-bottom: 16px;
    display: flex;
    .imgs {
      width: 120px;
      height: 88px;
      margin-right: 12px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .container {
      display: flex;
      flex: 1;
      flex-direction: column;
      justify-content: space-between;
      .desc {
        overflow: hidden;
        text-overflow: ellipsis; //显示省略号
        display: -webkit-box;
        -webkit-line-clamp: 2; //块元素显示的文本行数
        -webkit-box-orient: vertical;
        font-size: 14px;
      }
      .bottom {
        display: flex;
        justify-content: space-between;
        font-size: 11px;
        .left {
          display: flex;
          .icons {
            width: 16px;
            height: 16px;
            margin-right: 4px;
            img {
              width: 100%;
              height: 100%;
            }
          }
          span {
            color: #ff7e33;
          }
        }
        .right {
          display: flex;
          color: #afabb7;

          .icons {
            width: 13px;
            height: 10px;
            margin-right: 4px;
            img {
              width: 100%;
              height: 100%;
            }
          }
        }
      }
    }
  }
}
</style>
